﻿﻿<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-18 08:57:23
 * @LastEditTime: 2019-09-18 08:57:23
 * @LastEditors: your name
 -->
{namespace n=GeorgRinger\News\ViewHelpers}
{namespace ngoos=Jykj\Siteconfig\ViewHelpers}
<f:layout name="General"/>

<f:section name="content">
    <f:switch expression="{settings.templateLayout}">
        <f:case value="1">
        	<!-- 首页 -->
            <div class="c-content-box c-size-md c-bg-grey-1">
                <div class="backnews">
                    <div class="container">
                        <div class="clearix">
                            <div class="pull-left swiper-container swiper-container02 news-img-c swiper-container-horizontal">
                                <div id="banner" class="carousel slide" data-ride="carousel">
                                  <!-- Indicators -->
                                  <ol class="carousel-indicators banner-list">
                                  	<f:for each="{news}" as="newsItem" iteration="iterator">
	                                    <li data-target="#banner" data-slide-to="{iterator.index}" class="{f:if(condition:'{iterator.isFirst}', then:'active')}"></li>
	                                </f:for>
                                  </ol>

                                  <!-- Wrapper for slides -->
                                  <div class="carousel-inner" role="listbox">
                                    <f:for each="{news}" as="newsItem" iteration="iterator">
                                        <f:if condition="{newsItem.imgpath}">
                                            <f:then>
                                                <div class="item">
                                                	<f:if condition="{settings.showType}">
                                                		<f:then>
		                                                    <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                        <img src="uploads/tx_news/titles/{newsItem.imgpath}">
		                                                    </f:link.action>
                                                		</f:then>
                                                		<f:else>
		                                                    <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                        <img src="uploads/tx_news/titles/{newsItem.imgpath}">
		                                                    </f:link.action>
                                                		</f:else>
                                                	</f:if>
                                                </div>
                                            </f:then>
                                            <f:else>
                                                <f:if condition="{ngoos:getImgUrlFromContent(content:newsItem.bodytext)}">
                                                    <div class="item">
                                                    	<f:if condition="{settings.showType}">
                                                			<f:then>
		                                                        <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                            <f:image src="{ngoos:getImgUrlFromContent(content:newsItem.bodytext,nuid:newsItem.uid)}" width="520c" height="326c"/>
		                                                        </f:link.action>
                                                			</f:then>
                                                			<f:else>
		                                                        <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                            <f:image src="{ngoos:getImgUrlFromContent(content:newsItem.bodytext,nuid:newsItem.uid)}" width="520c" height="326c"/>
		                                                        </f:link.action>
                                                			</f:else>
                                                		</f:if>
                                                    </div>
                                                </f:if>
                                            </f:else>
                                        </f:if>
                                    </f:for>
                                  </div>
                                </div>
                            </div>
                            <ul class="pull-left news-list">
                                <f:if condition="{news}">
                                    <f:then>
                                        <f:for each="{news}" as="newsItem" iteration="iterator">
                                            <li>
                                            	<f:if condition="{settings.showType}">
                                            		<f:then>
                                            			<f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}" class="c-title c-font-uppercase c-font-bold c-theme-on-hover">
		                                                    <div class="news-list-tt">{newsItem.title}</div>
		                                                    <div class="news-list-txt">
		                                                        <f:if condition="{newsItem.teaser}">
		                                                            <f:then>{newsItem.teaser -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'0') -> f:format.stripTags()}</f:then>
		                                                            <f:else>{newsItem.bodytext -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'0') -> f:format.stripTags()}</f:else>
		                                                        </f:if>
		                                                    </div>
		                                                    <div class="news-list-date"><span><f:format.date format="d">{newsItem.datetime}</f:format.date></span><br><f:format.date format="Y-m">{newsItem.datetime}</f:format.date></div>
		                                                </f:link.action>
                                            		</f:then>
                                            		<f:else>
		                                            	<f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}" class="c-title c-font-uppercase c-font-bold c-theme-on-hover">
		                                                    <div class="news-list-tt">{newsItem.title}</div>
		                                                    <div class="news-list-txt">
		                                                        <f:if condition="{newsItem.teaser}">
		                                                            <f:then>{newsItem.teaser -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'0') -> f:format.stripTags()}</f:then>
		                                                            <f:else>{newsItem.bodytext -> f:format.crop(maxCharacters: '{settings.cropMaxCharacters}', respectWordBoundaries:'0') -> f:format.stripTags()}</f:else>
		                                                        </f:if>
		                                                    </div>
		                                                    <div class="news-list-date"><span><f:format.date format="d">{newsItem.datetime}</f:format.date></span><br><f:format.date format="Y-m">{newsItem.datetime}</f:format.date></div>
		                                                </f:link.action>
                                            		</f:else>
                                            	</f:if>
                                            </li>
                                        </f:for>
                                    </f:then>
                                    <f:else>
                                        <div class="item">
                                            <f:translate key="list_nonewsfound"/>
                                        </div>
                                    </f:else>
                                </f:if>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </f:case>
        <f:case value="2">
        	<!-- 新闻列表 -->
            <div>
                <f:if condition="{news}">
                    <f:then>
                        <ul class="news-list-view list-unstyled">
                            <f:if condition="{settings.hidePagination}">
                                <f:then>
                                    <f:for each="{news}" as="newsItem" iteration="iterator">
                                        <f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/>
                                    </f:for>
                                </f:then>
                                <f:else>
                                    <n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
                                        <f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
                                            <f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}"/>
                                        </f:for>
                                    </n:widget.paginate>
                                </f:else>
                            </f:if>
                        </ul>
                    </f:then>
                    <f:else>
                        <div class="no-news-found">
                            <f:translate key="list_nonewsfound"/>
                        </div>
                    </f:else>
                </f:if>
            </div>
        </f:case>
        <f:case value="3">
        	<!-- 视频列表 -->
            <div class="row project-list">
                <f:if condition="{settings.hidePagination}">
                    <f:then>
                        <f:for each="{news}" as="newsItem" iteration="iterator">
                           <div class="col-xs-12 col-sm-4 videos">
                                <div class="item">
                                	<f:if condition="{settings.showType}">
                                    	<f:then>
                                    		<f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                        <div class="pic">
		                                            <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                <f:image src="uploads/tx_news/titles/{newsItem.imgpath}" class="img-responsive" width="895c" height="503c"/>
		                                            </f:link.action>
		                                        </div>
		                                        <div class="showmsg">
		                                            <span class="name">
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                    {newsItem.title -> f:format.crop(maxCharacters: '200', respectWordBoundaries:'1') -> f:format.stripTags()}
		                                                </f:link.action>
		                                            </span>
		                                            <span class="playimg">
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                    <span class="playicon"></span>
		                                                </f:link.action>
		                                            </span>
		                                        </div>
		                                    </f:link.action>
                                    	</f:then>
                                    	<f:else>
                                    		<f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                        <div class="pic">
		                                            <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                <f:image src="uploads/tx_news/titles/{newsItem.imgpath}" class="img-responsive" width="895c" height="503c"/>
		                                            </f:link.action>
		                                        </div>
		                                        <div class="showmsg">
		                                            <span class="name">
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                    {newsItem.title -> f:format.crop(maxCharacters: '200', respectWordBoundaries:'1') -> f:format.stripTags()}
		                                                </f:link.action>
		                                            </span>
		                                            <span class="playimg">
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                    <span class="playicon"></span>
		                                                </f:link.action>
		                                            </span>
		                                        </div>
		                                    </f:link.action>
                                    	</f:else>
                                    </f:if>
                                </div>
                            </div>
                        </f:for>
                    </f:then>
                    <f:else>    
                        <n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
                            <f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
                                <div class="col-xs-12 col-sm-4 videos">
                                    <div class="item">
                                       <div class="pic">
		                                	<f:if condition="{settings.showType}">
		                                    	<f:then>
		                                            <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                <f:image src="uploads/tx_news/titles/{newsItem.imgpath}" class="img-responsive" width="895c" height="530c"/>
		                                            </f:link.action>
		                                        </f:then>
		                                        <f:else>
		                                            <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                <f:image src="uploads/tx_news/titles/{newsItem.imgpath}" class="img-responsive" width="895c" height="530c"/>
		                                            </f:link.action>
		                                        </f:else>
		                                	</f:if>
                                        </div>
                                        <div class="showmsg">
                                            <span class="name">
	                                            <f:if condition="{settings.showType}">
			                                    	<f:then>
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                    {newsItem.title -> f:format.crop(maxCharacters: '200', respectWordBoundaries:'1') -> f:format.stripTags()}
		                                                </f:link.action>
			                                        </f:then>
			                                        <f:else>
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                    {newsItem.title -> f:format.crop(maxCharacters: '200', respectWordBoundaries:'1') -> f:format.stripTags()}
		                                                </f:link.action>
			                                        </f:else>
			                                	</f:if>
                                            </span>
                                            <span class="playimg">
                                            	 <f:if condition="{settings.showType}">
			                                    	<f:then>
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem,newsid:newsItem.uid}">
		                                                    <span class="playicon"></span>
		                                                </f:link.action>
		                                            </f:then>
		                                            <f:else>
		                                                <f:link.action pageUid="{settings.detailPid}" extensionName="news" pluginName="pi1" controller="News" action="detail" arguments="{news : newsItem}">
		                                                    <span class="playicon"></span>
		                                                </f:link.action>
		                                            </f:else>
		                                        </f:if>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </f:for>
                        </n:widget.paginate>
                    </f:else>
                </f:if>
            </div>
        </f:case>
        <f:defaultCase>
            <div class="item">
               	 请选择布局
            </div>
        </f:defaultCase>
    </f:switch>
</f:section>